import {createStore,applyMiddleware} from 'redux'
import reduxLogger from 'redux-logger'
import {thunk} from 'redux-thunk'
import reducer from "./reducer"
import reduxPromise from 'redux-promise'

//不同的环境使用不同的中间件
let middleware = [thunk,reduxPromise],
    env = process.env.NODE_ENV;
if(env === 'development'){
    middleware.push(reduxLogger)
}

const store = createStore(
    reducer ,
    applyMiddleware(...middleware)
)

export default store
